#include "LoginWindow.h"
#include "ui_LoginWindow.h"
#include "WindowManager.h"
#include "Satory.h"

LoginWindow::LoginWindow(QWidget *parent) :
    BaseWindow(parent),
    ui(new Ui::LoginWindow)
{
    ui->setupUi(this);
    QObject::connect(ui->LoginButton,SIGNAL(clicked()),this,SLOT(OnLoginClick()));
    QObject::connect(ui->RegButton,SIGNAL(clicked()),this,SLOT(OnRegisterClick()));
}
void LoginWindow::SetUserId(const QString& userId)
{
    ui->LoginPlace->setText(userId);
}

void LoginWindow::OnLoginClick()
{

    Satory::GetInstance()->Login(ui->LoginPlace->text(),ui->PasswordPlace->text());


}
void LoginWindow::OnRegisterClick()
{
    WindowManager::GetInstance()->ShowWindow(WindowManager::REGISTERWINDOW);
}

LoginWindow::~LoginWindow()
{
    delete ui;
}
